<template>
  <div class="printForm">
    <div class="area-header">
      <span class="area-header-title">{{ $t('申请单') }}</span>
    </div>
    <table class="printTable">
      <tr>
        <td class="tit">{{ $t('申请事项') }}</td>
        <td colspan="3">{{ form.actTitle }}</td>
      </tr>
      <tr>
        <td class="tit">{{ $t('申请人') }}</td>
        <td>
          <UserSelect
            v-model="form.applicant"
          />
        </td>
        <td class="tit">{{ $t('申请时间') }}</td>
        <td>{{ parseTime(form.applicationTime) }}</td>
      </tr>
      <tr>
        <td class="tit">{{ $t('备注信息') }}</td>
        <td colspan="3">{{ form.remark }}</td>
      </tr>
    </table>

    <!-- 附件列表 -->
    <FileView :list.sync="form.fileList" data-type="oa_expense" :btn-show="!otherBtnHide" />

  </div>

</template>

<script>
    import { getOaMatters } from '@/api/oa/matters/oaMatters'

    export default {
      name: 'OaMatterForm',
      components: {
      },
      data() {
        return {
          openLocation: undefined,
          // 是否隐藏保存按钮
          btnHide: false,
          // 是否隐藏其它按钮
          otherBtnHide: false,
          // 表单参数
          form: {
            // 附件列表
            fileList: []
          },
          // 遮罩层
          loading: false,
          // 操作按钮默认不展示
          buttonShow: true
        }
      },
      mounted() {
          this.$bus.$emit('async_done')
      },
      methods: {
          // 初始化数据
          init(data) {
            this.loading = true
            if (data != null && data.id !== undefined && data.id !== '' && data.id !== null) {
              this.buttonShow = false
              // 根据ID查询数据
              getOaMatters(data.id).then(response => {
                this.form = response.data
                this.loading = false
              })
            }
          }

      }

    }
</script>
